<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../js/vue.js"></script>
    <title>Document</title>
    <style>
        input { font-size: 40px;}
    </style>

</head>
<body>
    <h1> 事件 </h1>
    <div id="app">
        <h1> {{ num }}</h1>
        <button v-on:click="add">加1</button>
        <button v-on:click="add2(5)">加5</button>
        <button @click="add2(10)">简化写法</button>
        <button @click="num+=30">简化2</button>

        <h1> 城市 {{ city }}</h1>
        <select @change="huan()">
            <option>请选择</option>
            <option>长沙</option>
            <option>株洲</option>
            <option>湘潭</option>
        </select>

        <h1>作业  = {{ hero }}</h1>
        <input @input="handle" type="text" :value="hero"/>
    </div>
</body>
<script>
 
var vm = new Vue({
    el: "#app",
    data: {
       num: 10,
       city: '请选择',
       hero: '龙龟'
    },
    methods:{
        add:function(){
            console.log( 'add...');
            this.num++
        },
        add2:function(v){
            this.num += v
        },
        huan(){
          var  v = event.target.value;
          this.city = v
        },
        handle(){
            this.hero =event.target.value;
        }
    }
});



</script>
</html>